package com.zjitc;

import com.zaxxer.hikari.HikariDataSource;
import java.sql.Connection;
import java.sql.SQLException;

/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/3/6 14:16
 * @description:
 */
public class App2 {

  public static void main(String[] args) {
    HikariDataSource dataSource = null;
    try {
      dataSource = new HikariDataSource();
      dataSource.setUsername("root");
      dataSource.setPassword("123456789");
      dataSource.setDriverClassName("com.mysql.jdbc.Driver");
      dataSource.setJdbcUrl("jdbc:mysql://localhost:3306/test");
      try {
        Connection connection = dataSource.getConnection();
        System.out.println(connection);
        System.out.println("111");
      }catch (SQLException e){
        e.printStackTrace();
      }
    }finally {
      if (dataSource != null){
        dataSource.close();
      }
    }
  }
}
